﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace 学生选课及成绩查询管理系统
{
    public partial class showTeachingClassOfsituation : Form
    {
        public showTeachingClassOfsituation()
        {
            InitializeComponent();
        }
        User user;

        internal User User
        {
            get { return user; }
            set { user = value; }
        }

        private void showTeachingClassOfsituation_Load(object sender, EventArgs e)
        {
            string sql = "select class.classname as '班名',count(student.stuno) as '班级人数' from class" +
            " join student on class.classno=student.classno" +
            " join teach on class.classno=teach.classno" +
            " join teacher on teach.tno=teacher.tno" +
            " group by classname,teacher.tno,class.clastate having class.clastate=1 and teacher.tno=" + user.Username;
            DataTable dt = DBAccess.GetTable(sql);
            dataGridView1.DataSource = dt;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
